﻿Public Class WebForm1
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        fubtnBrowse.Visible = False
        Label1.Visible = False

    End Sub

    Protected Sub btnUpload_Click(sender As Object, e As EventArgs) Handles btnUpload.Click
        btnTest.Visible = False
        fubtnBrowse.Visible = True
        btnUpload.Visible = False
        Label1.Visible = True

    End Sub

    Protected Sub btnSubmit_Click(sender As Object, e As EventArgs) Handles btnSubmit.Click
        If fubtnBrowse.HasFile Then
            Try
                fubtnBrowse.SaveAs("C:\" & _
                   fubtnBrowse.FileName)
                Label1.Text = "File name: " & _
                   fubtnBrowse.PostedFile.FileName & "<br>" & _
                   "File Size: " & _
                   fubtnBrowse.PostedFile.ContentLength & " kb<br>" & _
                   "Content type: " & _
                   fubtnBrowse.PostedFile.ContentType
            Catch ex As Exception
                Label1.Text = "ERROR: " & ex.Message.ToString()
            End Try
        Else
            Label1.Text = "You have not specified a file."
        End If

        btnTest.Visible = True
        fubtnBrowse.Visible = False
        btnUpload.Visible = True
    End Sub

End Class